/* 
 * Copyright (C) 2012 Martin Řehánek <rehan at mzk.cz>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

goog.provide('kramerius.audio.Player');

goog.require('goog.ui.CustomButton');
goog.require('goog.dom.DomHelper');

//goog.require('kramerius.audio.Playlist');


kramerius.audio.Player = function(playlist, container, playBtnImg, pauseBtnImg){
    this.playlist= playlist;
    this.container = container;
    this.playBtn = this.createButton(playBtnImg, container);
//this.pauseBtn = this.createButton(pauseBtnImg, container);
    
//    this.startImg = startImg;
//    this.stopImg = stopImg;
//    //startBtn = new goog.ui.Button('hi');
//    
//    var img = goog.dom.createDom(
//        'img',
//        {
//            'src':'ico/PNG/ButtonPlay.png'
//        }
//        );
//    console.log(img);
//    startBtn = new goog.ui.CustomButton(img);
//    //console.log(container);
//    //startBtn.decorate(container, undefined, domHelper);
//    //startBtn.render(container, undefined, domHelper);
//    startBtn.render(container);
//render();
}

kramerius.audio.Player.prototype.showInitialized = function(){
    this.playBtn.render(this.container);
    this.pauseBtn.render(this.container);
}

//kramerius.audio.Player.prototype.render = function(){
//    startBtn = new goog.ui.Button(this.startImg);
//    goog.dom.appendChild(container, startBtn);
//}

kramerius.audio.Player.prototype.createButton = function(imageUrl, container){
    console.log('image url: ' + imageUrl);
    var img = goog.dom.createDom(
        'img',
        {
            'src':imageUrl
        ,'class': 'ico'
        //,'width':'16px'
        }
        );
    return new goog.ui.CustomButton(img);
//    var button = new goog.ui.CustomButton('fff');
//    button.render(container);
//    var style = button.getElement().style;
//    style.backgroundImage = imageUrl;
//    style.backgroundPosition = 'center center';
//    style.backgroundRepeat = 'no-repeat';
//    style.height = '16px';
//    style.width = '16px';
//
//    return button;
    
//    var div = goog.dom.createDom('div', {
//        'class' : 'icon goog-inline-block'
//    });
//    span = goog.dom.createDom('span', {
//        'style': 'vertical-align:middle'
//    }, 
//    'Button with css image');
}


